# 单项目配置, ROOT_DIR == REPO_DIR

# xxxxxxxxxxxxxxxxxxx Paths configs
# message(STATUS "[MY] CMake binary dir: ${CMAKE_BINARY_DIR}")
set(ROOT_DIR "${CMAKE_SOURCE_DIR}" CACHE PATH "Project root directory")

# set(PATH_BIN ${CMAKE_BINARY_DIR} CACHE PATH "Binary output directory") # build 结果 output directory
set(PATH_BIN "${ROOT_DIR}/bin" CACHE PATH "Binary output directory")
message(STATUS "[MY] Binary output directory: ${PATH_BIN}")
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${PATH_BIN})
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${PATH_BIN})
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${PATH_BIN})

set(CMAKE_INSTALL_PREFIX "${ROOT_DIR}/inst-demo" CACHE PATH "Install path") # 安装目录, demo
message(STATUS "[MY] Binary install demo directory: ${CMAKE_INSTALL_PREFIX}")

# xxxxxxxxxxxxxxxxxxx toolchain configs
# 导出 clangd 需要的 build/compile_commands.json
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)

# xxxxxxxxxxxxxxxxxxx cmake generic settings
# option(BUILD_SHARED_LIBS "Build shared libraries" ON)
add_compile_options("/utf-8")
set(CMAKE_CXX_STANDARD 17) # C++ 标准
set(CMAKE_CXX_STANDARD_REQUIRED ON)

# ------------ 设置 linux RPATH
# set(CMAKE_SKIP_RPATH TRUE) # 禁用自动RPATH
set(CMAKE_INSTALL_RPATH "$ORIGIN/../lib")
set(CMAKE_INSTALL_RPATH_USE_LINK_PATH OFF)